package com.hjw.java.abstract_demo1;

/**
 * 银卡，支付打8.5折
 * @author hjwStrart
 * @create 2022-01-13 11:05
 */
public class SilverCard extends Card{

    {
        setDiscount(0.85);
    }


    public SilverCard(String noCard, String password, String user, Double balance) {
        super(noCard, password, user, balance);
    }

    @Override
    public Boolean pay(Double paymentAmount) {
        if (getBalance() < paymentAmount * 0.85  || paymentAmount < 0){
            return false;
        }else{
            setBalance( getBalance() - paymentAmount * 0.85 );

            return true;
        }
    }
}
